package com.yicong.ants.bean.account;

import com.cchao.simplelib.util.StringHelper;
import com.yicong.ants.manager.BusinessHelper;

import java.util.Locale;

/**
 * @author cchao
 * @version 2019-05-24.
 */
public class UserBean {
    String id = "";
    String mobile;
    String user_name;
    String nickname = "";
    String avatar = "";
    // 性别:0=女, 1=男
    String gender;
    String gender_text;
    String coin;
    String yc;
    float coin_float;
    // 最大可转赠门票
    float can_trans_coin;
    float can_advance_coin;
    float tax_level;
    String stock;
    String contribution;
    String level;
    String direct_child;
    String direct_auth_child;
    String indirect_child;
    String energy;
    String yc_energy;
    int daily_task;
    int role;
    String user_sig;

    public String getYc_energy() {
        return yc_energy;
    }

    public void setYc_energy(String yc_energy) {
        this.yc_energy = yc_energy;
    }

    public String getYc() {
        return yc;
    }

    public void setYc(String yc) {
        this.yc = yc;
    }

    public String getCreate_time() {
        return create_time;
    }

    public void setCreate_time(String create_time) {
        this.create_time = create_time;
    }

    String create_time;

    /**
     * 卡类型:0=无卡,10=体验卡，20=月卡,30=半年卡,40=年卡
     */
    int card_type;

    /**
     * 卡状态:0=无卡, 10=使用中, 20=已过期, 30=已冻结
     */
    int card_status;
    String card_num;
    String card_expire_date;
    // 体验卡 剩余体验次数
    int remain_trial_time;
    // 月卡 剩余预约次数
    int free_advance_time;

    /**
     * 身份证姓名
     */
    String id_card_name;
    String id_card_num;

    // 类型名称   月卡
    String card_type_text;
    /**
     * 门票数量
     */
    int score;
    int sign_count;
    int is_sign;
    int recommend_num;

    // 金额
    String cash_balance;
    String bonus_balance;
    String have_withdraw_bonus;
    String can_withdraw_bonus_quota;
    String total_bonus;
    String level_rewards;

    // 提示语
    String notice;
    // 0:未过期，1:已过期
    int is_expired;
    // 是否可以预约景区，月卡可以免费预约两次
    int can_free_advance;
    // 6折购买预约景区
    int discount_advance_time;
    String is_expired_text;
    // 卡状态:1=正常, 10=异常, 30=已冻结
    int user_status;
    String jwt_token = "";
    String mobile_mix;
    String id_card_num_mix;
    String wx_account;
    String nice_number;
    boolean have_nice_number;
    int location_code;
    /*年货节活动信息*/
    NewYearGoodsActivity activity;

    public boolean isBindCard() {
        return card_type > 0;
    }

    public boolean getIsAuth() {
        return StringHelper.isNotEmpty(id_card_num);
    }

    public boolean isNotBindCard() {
        return card_type == 0;
    }

    public String getMobile() {
        if (StringHelper.isNotEmpty(user_name)) {
            return user_name;
        }
        return mobile;
    }

    public String getIs_expired_text() {
        return is_expired == 1 ? "已过期" : "正常使用中";
    }

    public String getId_card_num() {
        return id_card_num;
    }

    public String getTotal_bonus() {
        return String.format(Locale.CHINESE, "%.2f", (Float.parseFloat(bonus_balance) + Float.parseFloat(have_withdraw_bonus)));
    }

    public String getMobile_mix() {
        return BusinessHelper.getMobileMix(mobile);
    }

    public float getCoin_float() {
        return Float.parseFloat(coin);
    }

    public String getId_card_num_mix() {
        try {
            return id_card_num.substring(0, 4) + "*****" + id_card_num.substring(14);
        } catch (Throwable e) {
            return id_card_num;
        }
    }

    public boolean isHave_nice_number() {
        if (StringHelper.isEmpty(nice_number)) {
            return false;
        }

        if (nice_number.length() >= 8) {
            return false;
        }
        return true;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getUser_name() {
        return user_name;
    }

    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getGender_text() {
        return gender_text;
    }

    public void setGender_text(String gender_text) {
        this.gender_text = gender_text;
    }

    public String getCoin() {
        return coin;
    }

    public void setCoin(String coin) {
        this.coin = coin;
    }

    public void setCoin_float(float coin_float) {
        this.coin_float = coin_float;
    }

    public float getCan_trans_coin() {
        return can_trans_coin;
    }

    public void setCan_trans_coin(float can_trans_coin) {
        this.can_trans_coin = can_trans_coin;
    }

    public float getCan_advance_coin() {
        return can_advance_coin;
    }

    public void setCan_advance_coin(float can_advance_coin) {
        this.can_advance_coin = can_advance_coin;
    }

    public float getTax_level() {
        return tax_level;
    }

    public void setTax_level(float tax_level) {
        this.tax_level = tax_level;
    }

    public String getStock() {
        return stock;
    }

    public void setStock(String stock) {
        this.stock = stock;
    }

    public String getContribution() {
        return contribution;
    }

    public void setContribution(String contribution) {
        this.contribution = contribution;
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public String getDirect_child() {
        return direct_child;
    }

    public void setDirect_child(String direct_child) {
        this.direct_child = direct_child;
    }

    public String getDirect_auth_child() {
        return direct_auth_child;
    }

    public void setDirect_auth_child(String direct_auth_child) {
        this.direct_auth_child = direct_auth_child;
    }

    public String getIndirect_child() {
        return indirect_child;
    }

    public void setIndirect_child(String indirect_child) {
        this.indirect_child = indirect_child;
    }

    public String getEnergy() {
        return energy;
    }

    public void setEnergy(String energy) {
        this.energy = energy;
    }

    public int getDaily_task() {
        return daily_task;
    }

    public void setDaily_task(int daily_task) {
        this.daily_task = daily_task;
    }

    public int getRole() {
        return role;
    }

    public void setRole(int role) {
        this.role = role;
    }

    public int getCard_type() {
        return card_type;
    }

    public void setCard_type(int card_type) {
        this.card_type = card_type;
    }

    public int getCard_status() {
        return card_status;
    }

    public void setCard_status(int card_status) {
        this.card_status = card_status;
    }

    public String getCard_num() {
        return card_num;
    }

    public void setCard_num(String card_num) {
        this.card_num = card_num;
    }

    public String getCard_expire_date() {
        return card_expire_date;
    }

    public void setCard_expire_date(String card_expire_date) {
        this.card_expire_date = card_expire_date;
    }

    public int getRemain_trial_time() {
        return remain_trial_time;
    }

    public void setRemain_trial_time(int remain_trial_time) {
        this.remain_trial_time = remain_trial_time;
    }

    public int getFree_advance_time() {
        return free_advance_time;
    }

    public void setFree_advance_time(int free_advance_time) {
        this.free_advance_time = free_advance_time;
    }

    public String getId_card_name() {
        return id_card_name;
    }

    public void setId_card_name(String id_card_name) {
        this.id_card_name = id_card_name;
    }

    public void setId_card_num(String id_card_num) {
        this.id_card_num = id_card_num;
    }

    public String getCard_type_text() {
        return card_type_text;
    }

    public void setCard_type_text(String card_type_text) {
        this.card_type_text = card_type_text;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public int getSign_count() {
        return sign_count;
    }

    public void setSign_count(int sign_count) {
        this.sign_count = sign_count;
    }

    public int getIs_sign() {
        return is_sign;
    }

    public void setIs_sign(int is_sign) {
        this.is_sign = is_sign;
    }

    public int getRecommend_num() {
        return recommend_num;
    }

    public void setRecommend_num(int recommend_num) {
        this.recommend_num = recommend_num;
    }

    public String getCash_balance() {
        return cash_balance;
    }

    public void setCash_balance(String cash_balance) {
        this.cash_balance = cash_balance;
    }

    public String getBonus_balance() {
        return bonus_balance;
    }

    public void setBonus_balance(String bonus_balance) {
        this.bonus_balance = bonus_balance;
    }

    public String getHave_withdraw_bonus() {
        return have_withdraw_bonus;
    }

    public void setHave_withdraw_bonus(String have_withdraw_bonus) {
        this.have_withdraw_bonus = have_withdraw_bonus;
    }

    public String getCan_withdraw_bonus_quota() {
        return can_withdraw_bonus_quota;
    }

    public void setCan_withdraw_bonus_quota(String can_withdraw_bonus_quota) {
        this.can_withdraw_bonus_quota = can_withdraw_bonus_quota;
    }

    public void setTotal_bonus(String total_bonus) {
        this.total_bonus = total_bonus;
    }

    public String getLevel_rewards() {
        return level_rewards;
    }

    public void setLevel_rewards(String level_rewards) {
        this.level_rewards = level_rewards;
    }

    public String getNotice() {
        return notice;
    }

    public void setNotice(String notice) {
        this.notice = notice;
    }

    public int getIs_expired() {
        return is_expired;
    }

    public void setIs_expired(int is_expired) {
        this.is_expired = is_expired;
    }

    public int getCan_free_advance() {
        return can_free_advance;
    }

    public void setCan_free_advance(int can_free_advance) {
        this.can_free_advance = can_free_advance;
    }

    public int getDiscount_advance_time() {
        return discount_advance_time;
    }

    public void setDiscount_advance_time(int discount_advance_time) {
        this.discount_advance_time = discount_advance_time;
    }

    public void setIs_expired_text(String is_expired_text) {
        this.is_expired_text = is_expired_text;
    }

    public int getUser_status() {
        return user_status;
    }

    public void setUser_status(int user_status) {
        this.user_status = user_status;
    }

    public String getJwt_token() {
        return jwt_token;
    }

    public void setJwt_token(String jwt_token) {
        this.jwt_token = jwt_token;
    }

    public void setMobile_mix(String mobile_mix) {
        this.mobile_mix = mobile_mix;
    }

    public void setId_card_num_mix(String id_card_num_mix) {
        this.id_card_num_mix = id_card_num_mix;
    }

    public String getWx_account() {
        return wx_account;
    }

    public void setWx_account(String wx_account) {
        this.wx_account = wx_account;
    }

    public String getNice_number() {
        return nice_number;
    }

    public void setNice_number(String nice_number) {
        this.nice_number = nice_number;
    }

    public void setHave_nice_number(boolean have_nice_number) {
        this.have_nice_number = have_nice_number;
    }

    public int getLocation_code() {
        return location_code;
    }

    public void setLocation_code(int location_code) {
        this.location_code = location_code;
    }

    public NewYearGoodsActivity getActivity() {
        return activity;
    }

    public void setActivity(NewYearGoodsActivity activity) {
        this.activity = activity;
    }

    public String getUser_sig() {
        return user_sig;
    }

    public void setUser_sig(String user_sig) {
        this.user_sig = user_sig;
    }
}
